package com.kotlin.heimaplayer.ui.fragment

import com.kotlin.heimaplayer.adapter.BaseListAdapter
import com.kotlin.heimaplayer.adapter.MvListAdapter
import com.kotlin.heimaplayer.base.BaseListFragment
import com.kotlin.heimaplayer.base.BaseListPresenter
import com.kotlin.heimaplayer.model.WyMvItemBean
import com.kotlin.heimaplayer.presenter.impl.MvListPresenterImpl
import com.kotlin.heimaplayer.ui.activity.VideoPlayerActivity
import com.kotlin.heimaplayer.view.MvListView
import com.kotlin.heimaplayer.widget.MvItemView
import org.jetbrains.anko.support.v4.startActivity

class MvPagerFragment: BaseListFragment<List<WyMvItemBean>, WyMvItemBean, MvItemView>(),
    MvListView {
    var code:String? = null

    override fun init() {
        code = arguments?.getString("args")
    }

    override fun getSpecialAdapter(): BaseListAdapter<WyMvItemBean, MvItemView> {
        return MvListAdapter()
    }

    override fun getSpecialPresenter(): BaseListPresenter {
        return MvListPresenterImpl(code!!,this)
    }

    override fun getList(response: List<WyMvItemBean>?): List<WyMvItemBean>? {
        return response
    }

    override fun initListener() {
        super.initListener()
        // 设置条目点击事件监听函数
        adapter.setMyListener {
            startActivity<VideoPlayerActivity>("vid" to it.vid)
        }
    }

}